package it.mvc.dinamiccomponents;

import it.mvc.layoutmanager.ComponentMover;
import it.mvc.layoutmanager.ComponentResizer;

import java.awt.Component;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

import javax.swing.JPanel;

public class DynamicJPanel extends JPanel implements ComponentListener {
	private ComponentResizer resizer;
	private ComponentMover mover;

	public DynamicJPanel() {
		resizer = new DynamicComponentResizer();
		mover = new DynamicComponentMover();
		resizer.registerComponent(this);
		mover.registerComponent(this);
		this.addComponentListener(this);
	}

	private class DynamicComponentResizer extends ComponentResizer {
		public DynamicComponentResizer() {
			super();
		}
	}

	private class DynamicComponentMover extends ComponentMover {
		public DynamicComponentMover() {
			super();
		}

		@Override
		public boolean isDragEnable() {
			// TODO Auto-generated method stub
			return resizer.notInResizeMode();
		}

	}

	@Override
	public void componentResized(ComponentEvent e) {

	}

	@Override
	public void componentMoved(ComponentEvent e) {

	}

	@Override
	public void componentShown(ComponentEvent e) {

	}

	@Override
	public void componentHidden(ComponentEvent e) {

	}

	private void printEvent(String msg, Object event) {

	}

}
